<?php

/**
 * Created by PhpStorm.
 * User: LiuJie
 * Date: 2018/7/19
 * Time: 14:33
 */
namespace App\Http\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use \App\Http\Models\Post;

class User extends Authenticatable
{
	protected $table = 'users';
//	设置无黑名单字段
	protected $guarded = ['id'];


    public function posts()
    {
        return $this->hasMany(Post::class,'user_id','id');
	}

//	有多少粉丝
	public function hasFans()
    {
        return $this->hasMany(\App\Http\Models\Fan::class,'star_id','id');
    }

//    关注多少人
    public function hasFollow()
    {
        return $this->hasMany(\App\Http\Models\Fan::class,'fan_id','id');
    }

}